//
// Created by Administrator on 2024/11/20.
//

#include "OpenSSLUtils.h"

std::string OpenSSLUtils::sha1Hash(const std::string &value) {
    unsigned char hash[SHA_DIGEST_LENGTH];
    SHA1(reinterpret_cast<const unsigned char *>(value.c_str()), value.length(), hash);

    std::stringstream ss;
    for (unsigned char i: hash) {
        ss << std::setw(2) << std::setfill('0') << std::hex << (int) i;
    }

    return ss.str();
}
